﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Compiler.CompilerAPI.Contexts;
using Compiler.TableOfSymbols;

namespace Compiler.CompilerAPI
{
    /// <summary>
    /// Окружение компиляции
    /// </summary>
    public class CompilationEnvironment
    {
        private ErrorHandler errorManager;

        private NETTypesBijectiveMap typesBijectiveMap;

        private GlobalContext mainContext;
        private StackContext workingContext;

        public ErrorHandler ErrorManager
        {
            get { return errorManager; }
        }

        public NETTypesBijectiveMap TypesBijectiveMap
        {
            get { return typesBijectiveMap; }
        }

        public GlobalContext MainContext
        {
            get { return mainContext; }
        }
        public StackContext WorkingContext
        {
            get { return workingContext; }
        }

        public CompilationEnvironment(HashSet<DllLibInfo> usedDLLs)
        {
            if (usedDLLs == null)
                throw new ArgumentNullException("usedDLLs can not be null");
            errorManager = new ErrorHandler();
            typesBijectiveMap = new NETTypesBijectiveMap();
            mainContext = new GlobalContext(typesBijectiveMap, usedDLLs);
            workingContext = new StackContext(typesBijectiveMap, mainContext);
        }

        
    }
}
